class SearchScene extends Scene{
    private back:eui.Image;
    private searchImage:eui.Image;
    private searchBoard:eui.TextInput;
    private searchButton:eui.Image;
    private scroller:eui.VScrollBar;
    private group:eui.Group;
    private content:string;
    private verticalScrollBar:eui.Scroller;
    private dataGroup:eui.DataGroup;
    private sourceArr:any[];
    public constructor(){
        super();          
    }
    public onSkinLoaded():void{
        this.back.addEventListener(egret.TouchEvent.TOUCH_TAP,this.onclick_back,this);
        this.searchButton.addEventListener(egret.TouchEvent.TOUCH_TAP,this.btn_Search,this);
    }

    public onclick_back():void{
       SceneManager.instance.removeScene(this);
    }
    
    public btn_Search():void{
        //先创建一个数组
        this.sourceArr= [];
       this.content=this.searchBoard.textDisplay.text;//获取输入框中的内容
       if(this.content==""){
           alert("请输入搜索内容!");
       }
       else{
        for(var m:number=0;m<CET4Scene.obj.length;m++){//遍历json数组
           var reg=new RegExp(this.content);//正则表达式的构造方法
           if(reg.test(CET4Scene.obj[m].english)){
               //给数据中添加一个含有"label"属性的对象
               this.sourceArr.push({label:CET4Scene.obj[m].english,meaning:CET4Scene.obj[m].meaning});
           }
        }
        //用ArrayCollection包装
        var myCollection:eui.ArrayCollection = new eui.ArrayCollection(this.sourceArr);
        this.dataGroup.dataProvider = myCollection;
        this.dataGroup.percentWidth = 100;
        this.dataGroup.percentHeight = 100;
        this.dataGroup.itemRenderer = LabelRenderer;
       }
    }
    
}